#include "FileIDGenerator.h"

FileIDGenerator *FileIDGenerator::globalInstance = new FileIDGenerator();

FileIDGenerator::FileIDGenerator()
{
}

FileIDGenerator::~FileIDGenerator()
{
}

string FileIDGenerator::generatorFileID()
{
    m_mutex.lock();

    // 获取当前时间点
    auto now = std::chrono::system_clock::now();

    // 转换为自1970年1月1日以来的毫秒数
    auto duration = now.time_since_epoch();
    auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();

    m_mutex.unlock();
    // 输出毫秒级时间戳
    std::cout << "Milliseconds since epoch: " << millis << std::endl;
    return to_string(millis);
}
